#include <iostream>
using namespace std;

int main() {
    int m,k;
    cin >> m >> k;
    if(m <= 1) {
        cout << "NO";
        return 0;
    }

    int threeNum = 0; // 数字3的个数
    if (m % 19 == 0)
    {
        //判断是否含有k个3
        while (m != 0)
        {
            int lastNum = m % 10;
            if (lastNum == 3)
            {
                threeNum++;
            }
            m = m / 10;
        }
        if (threeNum == k)
        {
            cout << "YES";
            return 0;
        }
    }
    cout << "NO";
    
    return 0;
}